﻿<phone:PhoneApplicationPage 
    x:Class="SverigesRadio.SverigesRadioApp.WindowsPhoneApplication.Views.Player.PlayerPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:Converters="clr-namespace:SverigesRadio.SverigesRadioApp.WindowsPhoneApplication.Converters" xmlns:ApplicationBar="clr-namespace:SverigesRadio.SverigesRadioApp.WindowsPhoneApplication.Controls.ApplicationBar" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <Converters:VisibilityConverter x:Key="VisibilityConverter" />
        <Converters:InvertVisibilityConverter x:Key="InvertVisibilityConverter" />
    </phone:PhoneApplicationPage.Resources>


    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">

        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Image Grid.Row="0" Visibility="{Binding DarkThemeVisibility}" Source="/SverigesRadio.SverigesRadioApp.WindowsPhoneApplication;component/Images/Sveriges_Radio_Logotype_Black.png" Height="50" />
        <Image Grid.Row="0" Visibility="{Binding DarkThemeVisibility, Converter={StaticResource InvertVisibilityConverter}}" Source="/SverigesRadio.SverigesRadioApp.WindowsPhoneApplication;component/Images/Sveriges_Radio_Logotype_White.png" Height="50" />
        
        <controls:Pivot Grid.Row="1">
            <controls:PivotItem Header="Spelare">
                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">

                    <StackPanel>
                    </StackPanel>
                </ScrollViewer>

            </controls:PivotItem>
        </controls:Pivot>

        <Grid Grid.Row="2" Margin="12 10 0 5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>

            </Grid.ColumnDefinitions>

            <TextBlock Text="{Binding PlayState}" Grid.Column="0"/>

            <TextBlock Text="Buffer: " Grid.Column="1" HorizontalAlignment="Right" Visibility="{Binding BufferVisibility}" />                
            <TextBlock Text="{Binding BufferSize, StringFormat=0%}" Grid.Column="2" Visibility="{Binding BufferVisibility}" Margin="0 0 12 0"/>

        </Grid>


        <ApplicationBar:BindableApplicationBar Mode="Default" IsVisible="True">
            <ApplicationBar:BindableApplicationBarIconButton Command="{Binding PlayCommand}" IsEnabled="{Binding IsPlayEnabled}" Text="Spela" IconUri="/images/Play.png" />

            <ApplicationBar:BindableApplicationBarIconButton Command="{Binding StopCommand}" IsEnabled="{Binding IsPlaying}" Text="Stop" IconUri="/images/Cancel.png" />

            <ApplicationBar:BindableApplicationBarMenuItem Text="Besök hemsida" Command="{Binding VisitHomePageCommand}"/>

        </ApplicationBar:BindableApplicationBar>

    </Grid>


</phone:PhoneApplicationPage>
